Skip to content

Implement PolygonClipper V2 - #43

Merged
JimBobSquarePants merged 24 commits into
mainfrom
js/polygonclipper-v2
Nov 23, 2026
Merged

JimBobSquarePants merged 24 commits into
mainfrom
js/polygonclipper-v2

Conversation

@JimBobSquarePants

@JimBobSquarePants JimBobSquarePants commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Add PolygonClipper V2 with explicit fill rules in the Martinez sweep. Binary clipping accepts raw contours without a normalization pass. Normalize uses the same engine and retains the full containment hierarchy.

Add open-path clipping, explicit contour closure, stroking, and polygon offsets. Retain double coordinates and use the existing stroker for offsets.

Add struct enumerators and reduce sweep and output allocations. Set the package version floor to 2.0 and add its description and tags.

Recover nonzero determinants hidden by rounded products and retain intersection precision until coordinates are constructed. Order collinear events consistently. Exact rational checks support the four fixture corrections. Check the issue 1051 boundary edges instead of assuming identical walk grouping.
Use one Martinez path for explicit fill rules and unary cleanup. Stage complete point events before publishing boundary history. Preserve distinct rounded crossings and use reliable orientation predicates. Reuse endpoint queues and restore safe sweep bounds. Keep explicit contour closure and test geometry against independent expectations.
Use retained coordinate differences for the parallel decision. Select collinear overlap endpoints directly from source coordinates, without rounded projection parameters. Cover reversed operands, reversed directions and short overlaps near long-segment endpoints.
Copy retained slots beyond the active count. Cover growth immediately after Clear and after partial reuse, checking event identity and refreshed coordinates.
Replace incident status blocks in place and remove full-suffix result rank updates. Bound stale queue entries and store source pool indices without managed references.

Reuse connector and sweep scratch storage, reduce event size, and remove redundant fill checks and contour traversal work.

Validation: 808 tests passed on both .NET 10 and .NET 11, with two existing skips each. Exact geometry snapshots match across 20 comparison cases.
Reuse ray ordering when bundling outgoing intervals and inline the existing fill-rule membership helpers.

Validation: 808 tests passed on both .NET 10 and .NET 11, with two existing skips each. All 20 exact output snapshots match. NonZero star union benchmarks take 4.3-4.8% less time.
Remove the public unary Union overload and route Normalize directly through the existing Martinez execution. Update stroke cleanup, test callers, and README examples.

Keep independent geometry assertions and remove duplicate checks of the deleted alias. Release validation: 808 tests passed on both .NET 10 and .NET 11, with two existing skips each. Whitespace checks passed.
Use the non-degenerate support for point incidence tests. Return perpendicular axis intersections from their exact overlapping bounds without determinant division.

Add analytic point/diagonal and scaled axis-crossing regressions. The point/diagonal test reproduced the prior asymmetric result before the correction.
@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.59223% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 82%. Comparing base (280a0a3) to head (2506dfb).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/PolygonClipper/PolygonOffsetter.cs 88% 6 Missing and 4 partials ⚠️
src/PolygonClipper/StatusLine.cs 73% 7 Missing ⚠️
src/PolygonClipper/SweepEventPoolList.cs 82% 4 Missing and 1 partial ⚠️
src/PolygonClipper/PolygonStroker.cs 95% 3 Missing and 1 partial ⚠️
src/PolygonClipper/SweepEventComparer.cs 88% 1 Missing and 2 partials ⚠️
src/PolygonClipper/PolygonUtilities.cs 97% 2 Missing ⚠️
src/PolygonClipper/SweepEvent.cs 96% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##           main    #43     +/-   ##
=====================================
+ Coverage    73%    82%     +8%     
=====================================
  Files        30     27      -3     
  Lines      3596   2342   -1254     
  Branches    866    536    -330     
=====================================
- Hits       2654   1924    -730     
+ Misses      718    350    -368     
+ Partials    224     68    -156     
Flag Coverage Δ
unittests 82% <93%> (+8%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JimBobSquarePants
JimBobSquarePants merged commit f1e5f5c into main Nov 23, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant